package com.hsd.controller;

import com.hsd.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ Author：杨宇健
 * @ Package：com.hsd.controller
 * @ Project：hsd_calculator
 * @ Description: 加法计算
 * @ Date：2025/4/26
 */

@RestController
@RequestMapping("/calculate")
@Slf4j
public class AdditionController{

    @PostMapping("/addition")
    public Result addition(@RequestBody Map<String,Double>request){
        //n为加数1，m为加数2
        Double n = request.get("num");
        Double m = request.get("n");
        log.info("接收到的数:加数1n{},加数2m:{}",n,m);
        //计算结果
        double result = n+m;

        return Result.success(result);
    }
}
